package chapter06

object Demo10_AnnoymousClass {
  def main(args: Array[String]): Unit = {
    val person: Person10 = new Person10 {
      override var name: String = "alice"
      override var age: Int = 18

      override def eat(): Unit = println("person eat")
    }
    println(person.age)  //
    println(person.name)
    person.eat()
  }
}
//定义抽象类
abstract class Person10{
  var name: String
  var age: Int
  def eat(): Unit
}
